//
//  ViewController.m
//  TheTimer
//
//  Created by 李江湖 on 2018/7/5.
//  Copyright © 2018年 李江湖. All rights reserved.
//

#import "ViewController.h"
#import "LMTimeTool.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *timeLab;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    WeakSelf;
//    NSString *startTime = @"2018-07-05 17:44:00";//活动开始时间
//    NSString *endTime = @"2018-07-05 17:45:00";//活动结束时间
//    NSString *sysTime = @"2018-07-05 17:43:00";//当前时间
//
//    [LMTimeTool shareManage].initTime(self,@selector(timer:)).timeParameter(startTime,endTime,sysTime).success(^(LMTimeType type){
//        if (type == LMTimeNoStart) {
//
//        } else if (type == LMTimeEnd){
//            weakSelf.timeLab.textColor = [UIColor yellowColor];
//        } else if (type == LMTimeOngoing){
//            weakSelf.timeLab.textColor = [UIColor redColor];
//        }
//    }).cycle(^(LMTimeType type,BOOL stop,NSInteger day,NSInteger hour,NSInteger minute,NSInteger second){
//        if (stop) {
//
////            倒计时结束为0时-需要重新刷新时间
//            [self update];
//        }
//        //刷新时间UI
//        weakSelf.timeLab.text = [NSString stringWithFormat:@"%02zd 天 %02zd 时 %02zd 分 %02zd 秒",day,hour,minute,second];
//    });
//    [LMTimeTool startGcdTimer];

}
- (void)update {
    NSString *startTime = @"2018-07-05 17:44:00";//活动开始时间
    NSString *endTime = @"2018-07-05 17:45:00";//活动结束时间
    NSString *sysTime = @"2018-07-05 17:44:00";//当前时间
    [LMTimeTool shareManage].timeParameter(startTime,endTime,sysTime).setTimeType(LMTheTimeBegin);
}
-(void)timer:(NSTimer *)timer{
    [[LMTimeTool shareManage]  runTime];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
